using System.Linq;
using NUnit.Framework;

namespace Solver
{
	/// <summary>
	/// Find the 10001st prime.
	/// </summary>
	public class Problem007 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 7; }
		}

		public string Solve()
		{
			return Solve(10001).ToString();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual(13, Solve(6));
			Assert.AreEqual(104743, Solve(10001));
		}

		private static long Solve(int param)
		{
			return new EratosthenesSieve64(104743).Primes().ElementAt(param - 1);
		}
	}
}